require(["jquery",'public','swiper'],function($,public,swiper) {
    public.footer(1);
    //public.headertitle('全媒体');
    public.allocator();

    $('.header_center').on('click mousedown','.toSearch',function(){
        window.location.href = MODULE + 'PublicJump/search';
    });

    function getData(){
        $.ajax({
            data: {type: 1},
            type: 'post',
            dataType: 'json',
            url: MODULE+'Index/new_goods',           
        }).success(function (res) {
            console.log(res); 
            if(!res.data)  {
                return false;
            }
            var _html = '';
            res.data.forEach(function(i){
                _html += '<li class="myrelease_list_item">'
                        +            '<a class="myrelease_list_item_link clearfix" href="'+MODULE+'PublicJump/releaseInfo/id/'+i.goods_id+'">'
                        +                '<div class="myrelease_list_item_left">'
                        +                    '<img src="'+PUBLIC+i.goods_picture_path+'" />'
                        +                '</div>'
                        +                '<div class="myrelease_list_item_right">'
                        +                    '<p class="myrelease_list_item_txt">'+i.goods_name+'</p>'
                        +                    '<p class="myrelease_list_item_time">'+i.goods_updated_time+'</p>'
                        +                '</div>'
                        +            '</a>'
                        +        '</li>'; 
            });
            $('.myrelease_list').append(_html);
        }).fail(function (jqXHR, textStatus, errorThrown) {});
    }

    getData();

    //页面加载完毕
    public.loaded();
    
    var mySwiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        centeredSlides: true,
        autoplay: 2000,
        loop: true, //无缝循环播放
        autoHeight: true,
        //autoplayDisableOnInteraction: false //用户操作后停止轮播
    }); 
})